<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%--
    Document   : blank
    Created on : 19.11.2008, 15:33:27
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<body>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <c:choose>
            <c:when test="${isStudent}">
                <h3 class="reallynow">Курсы студента <a href="Profile?id=${user.account}" title="Профиль студента">${user.name}</a></h3>
                <c:set var="profileType" value="Student"/>
                <c:set var="signOnButtonValue" value="Зачислить"/>
                <c:set var="signOffButtonValue" value="Отчислить"/>
            </c:when><c:otherwise>
                <c:if test="${isTutor}">
                    <h3 class="reallynow">Курсы тьютора <a href="Profile?id=${user.account}" title="Профиль тьютора">${user.name}</a></h3>
                    <c:set var="profileType" value="Tutor"/>
                    <c:set var="signOnButtonValue" value="Назначить"/>
                    <c:set var="signOffButtonValue" value="Снять"/>
                </c:if>
            </c:otherwise></c:choose>
        <c:choose>
            <c:when test="${!empty courseList}">
                <form id="form">
                    <table width="100%" id="courseDelTable" class="datatable" align="left">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th width="35px">№</th>
                                <th>Название курса</th>
                                <th>Направление<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></th>
                                <th style="width: 80px;">Операции</th>
                            </tr>
                        </thead>
                        <tbody>

                            <c:forEach items="${courseList}" var="course">
                                <tr>
                                    <td style="width: 35px;">${course.id}</td>
                                    <td>${course.numeral}</td>
                                    <td><a href="Course?id=${course.id}" title="Подробнее о курсе">${course.title}</a></td>
                                    <td>${course.curriculumLevel.title}</td>
                                    <td style="padding: 0px; width: 80px;">
                                        <input type="button" value="${signOffButtonValue}" style="margin: 0px; width: 100%;"
                                               onclick="window.location='Sign${profileType}Off?userId=${user.account}&courseId=${course.id}&from=SignUser'"/>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </form>
            </c:when>
            <c:otherwise>
                <p>Список курсов пуст</p>
            </c:otherwise>
        </c:choose>

                <form id="form" style="text-align: center; clear: both;">
                    <a href="Profile?id=${user.account}">
                        <input type="button" value="Перейти к профилю" style="width: 30%;"/>
                    </a>
                </form>
    </div>

    <br/>

    <div id="box" class="rounded-divcascade">
        <c:choose>
            <c:when test="${isStudent}">
                <h3 class="reallynow">Зачисление на курс студента ${user.name}</h3>
            </c:when><c:otherwise>
                <c:if test="${isTutor}">
                    <h3 class="reallynow">Назначение на курс тьютора ${user.name}</h3>
                </c:if>
            </c:otherwise></c:choose>
        <c:choose>
            <c:when test="${!empty courseAddList}">
                <form id="form">
                    <table width="100%" id="courseAddTable" class="datatable" align="left">
                        <thead>
                            <tr>
                                <th width="40px">ID</th>
                                <th width="35px">№</th>
                                <th>Название курса</th>
                                <th>Направление<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></th>
                                <th width="80px">Операции</th>
                            </tr>
                        </thead>
                        <tbody>

                            <c:forEach items="${courseAddList}" var="courseAdd">
                                <tr>
                                    <td>${courseAdd.id}</td>
                                    <td>${courseAdd.numeral}</td>
                                    <td><a href="Course?id=${courseAdd.id}" title="Подробнее о курсе">${courseAdd.title}</a></td>
                                    <td>${courseAdd.curriculumLevel.title}</td>
                                    <td style="padding: 0px;">
                                        <input type="button" value="${signOnButtonValue}" style="margin: 0px; width: 100%;"
                                               onclick="window.location='Sign${profileType}On?userId=${user.account}&courseId=${courseAdd.id}&from=SignUser'"/>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </form>
            </c:when>
            <c:otherwise>
                <p>Список курсов пуст</p>
            </c:otherwise>
        </c:choose>

        <form id="form" style="text-align: center; clear: both;">
                    <a href="Profile?id=${user.account}">
                        <input type="button" value="Перейти к профилю" style="width: 30%;"/>
                    </a>
                </form>
    </div>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#liUsers").addClass("current");
            $('div#top-panel p').text('Список дистанционных курсов пользователя');

            doDatatable('courseAddTable');
            doDatatable('courseDelTable');
        });
    </script>
</body>

